<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">配送员列表</div>
                </div>
                <div class="widget-body am-fr">
                    <div class="am-scrollable-horizontal am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped
                         tpl-table-black am-text-nowrap">
                            <thead>
                            <tr>
                                <th>用户ID</th>
                                <th>微信头像</th>
                                <th>微信昵称</th>
                                <th>性别</th>
                                <th>国家</th>
                                <th>省份</th>
                                <th>城市</th>
                                <th>注册时间</th>
                                <th>是否在线</th>
                                <th>工作状态</th>
                                <th>帐户状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if (!$list->isEmpty()): foreach ($list as $item): ?>
                                <tr>
                                    <td class="am-text-middle"><?= $item['user_id'] ?></td>
                                    <td class="am-text-middle">
                                        <a href="<?= $item['avatarUrl'] ?>" title="点击查看大图" target="_blank">
                                            <img src="<?= $item['avatarUrl'] ?>" width="72" height="72" alt="">
                                        </a>
                                    </td>
                                    <td class="am-text-middle"><?= $item['nickName'] ?></td>
                                    <td class="am-text-middle"><?= $item['gender'] ?></td>
                                    <td class="am-text-middle"><?= $item['country'] ?: '--' ?></td>
                                    <td class="am-text-middle"><?= $item['province'] ?: '--' ?></td>
                                    <td class="am-text-middle"><?= $item['city'] ?: '--' ?></td>
                                    <td class="am-text-middle"><?= $item['create_time'] ?></td>
                                    <td class="am-text-middle"><?php
                                        if ($item['isonline'] === "Y") {
                                            echo '<span style="color: green">在线</span>';
                                        } else {
                                            echo '<span style="color: red">离线</span>';
                                        }
                                        ?></td>
                                    <td class="am-text-middle"><?php
                                        if ($item['isworking'] === "Y") {
                                            echo '<span style="color: red">工作中</span>';
                                        } else {
                                            echo '<span style="color: green">空闲中</span>';
                                        }
                                        ?></td>
                                    <td class="am-text-middle"><?php
                                        if ($item['status'] === 2) {
                                            echo '已禁用';
                                        } else {
                                            echo '正常';
                                        }
                                        ?></td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="javascript:;"
                                               class="item-delete edits tpl-table-black-operation-green"
                                               data-id="<?= $item['user_id'] ?>">
                                                恢复普通用户
                                            </a>
                                            <?php
                                            if ($item['status'] == 2) {
                                                //0未审核 1提交审核  2审核失败 3审核成功
                                                ?><a href="javascript:;"
                                                     class="am-btn-success add tpl-table-black-operation-del"
                                                     data-id="<?= $item['user_id'] ?>">
                                                    <i class="am-icon-user-plus"></i> 启用
                                                </a><?php
                                            } else {
                                                ?>
                                                <a href="javascript:;"
                                                   class="item-delete delect tpl-table-black-operation-del"
                                                   data-id="<?= $item['user_id'] ?>">
                                                    <i class="am-icon-user-times"></i> 禁用
                                                </a>
                                                <?php
                                            }
                                            ?>

                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; else: ?>
                                <tr>
                                    <td colspan="8" class="am-text-center">暂无记录</td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr"><?= $list->render() ?> </div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：<?= $list->total() ?></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {

        /*启用：*/
        $('.tpl-table-black-operation .add').add('user_id', "<?= url('user/add') ?>");

        /*禁用：*/
        $('.tpl-table-black-operation .delect').delete('user_id', "<?= url('user/delete') ?>");

        /*恢复普通用户：*/
        var params = {};
        params["user_type"] = 1;
        params["status"] = 0;
        $('.tpl-table-black-operation .edits').edit('user_id', "<?= url('user/appoint') ?>",params);
    });
</script>

